<?php
namespace app\service;
use think\facade\Db;
class roomUserService{
    public function userList($community_id,$page,$where){

        return Db::name('room_user')->where('community_id','in',$community_id)->where($where)->order('id desc')->paginate(200, false, [
            'page'  =>  $page,
            'query' =>  $where
        ]);


    }
    public function userCount($community_id,$where){
        return Db::name('room_user')->where('community_id','in',$community_id)->where($where)->count();
    }

    public function deleteUser($id) {
        $info=Db::name('room_user')->where('id', $id)->find();
        $info["operator_id"]=session("id");
        $info["operator_name"]=session("name");
        $info["operator_time"]=date('Y-m-d H:i:s');
        $result=Db::table('room_user_del')->insert($info);
        if($result){
            return Db::name('room_user')->where('id', $id)->delete();
        }else{
            return false;
        }
    }
}